package com.qdlc.p2p.manage.action;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Action;

import com.opensymphony.xwork2.ModelDriven;
import com.qdlc.p2p.biz.service.ScoreService;
import com.qdlc.p2p.biz.web.action.BaseAction;
import com.qdlc.p2p.dal.common.model.jpa.PageDataList;
import com.qdlc.p2p.dal.model.ScoreModel;

/**
 * 用户积分管理
 * @author xxx
 * @version 2.0
 * @date 2015年6月15日 下午5:47:31
 */
public class ManageScoreAction extends BaseAction<ScoreModel> implements ModelDriven<ScoreModel> {

	@Resource
	private ScoreService scoreService;
	
	private Map<String, Object> data;
	
	/**
	 * 积分管理页面
	 * @return
	 */
	@Action("/modules/user/score/manage")
	public String manage(){
		return "manage";
	}

	/**
	 * 用户积分分页
	 * @return
	 */
	@Action("/modules/user/score/scoreList")
	public void scoreList () throws Exception {
		PageDataList<ScoreModel> page = scoreService.findPageList(model);
		data = new HashMap<String, Object>();
		data.put("total", page.getPage().getTotal());
		data.put("rows", page.getList());
		printJson(getStringOfJpaObj(data));
	}
	
}
